/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dispmovil;

import Objetos.PropiedadesIP;
import Ventanas.Principal;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Sebas
 */
public class DispMovil {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here

        if (!(new File("C:\\DispMovil\\Memoria.csv")).exists()) {
            
            if (!(new File("C:\\DispMovil\\")).exists()) {
                (new File("C:\\DispMovil\\")).mkdir();
            }
            
            String fileName = "C:\\DispMovil\\Memoria.csv";
            // File f = new File(fileName);
            FileWriter fw;
            try {
                // FileWriter fichero = new FileWriter("c:/prueba.txt",true);
                fw = new FileWriter(fileName, true);
            } catch (IOException ex) {
                Logger.getLogger(DispMovil.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

        Properties props = new Properties();
        try {
            props.load(new FileInputStream("./DIR_IP.properties"));
        } catch (IOException ex) {
            Logger.getLogger(DispMovil.class.getName()).log(Level.SEVERE, null, ex);
        }
        String IPServCentral = props.getProperty("SERVIDOR");
        String IPDispMovil = props.getProperty("DISPMOVIL");
        PropiedadesIP direcciones = PropiedadesIP.getInstance();
        direcciones.setServidorCentralIP(IPServCentral);
        direcciones.setDispMovilIP(IPDispMovil);

        Principal PpalFrame = new Principal("LA RED EN TU DISPOSITIVO MOVIL");
        PpalFrame.setVisible(true);
        PpalFrame.setLocationRelativeTo(null);
    }
}
